#include "support_common.h" /* include peripheral declarations and more */
#include <stdio.h>
#include "uc_led.h"

void uc_led_all_off()
{
       uc_led_off(0);
       uc_led_off(1);
       uc_led_off(2);
       uc_led_off(3);
}
void uc_led_all_on()
{
       uc_led_on(0);
       uc_led_on(1);
       uc_led_on(2);
       uc_led_on(3);
}
void uc_led_all_toggle()
{
       uc_led_toggle(0);
       uc_led_toggle(1);
       uc_led_toggle(2);
       uc_led_toggle(3);
}
void uc_led_init()
{
       gpio_port_tc_init(0);
       gpio_port_tc_init(1);
       gpio_port_tc_init(2);
       gpio_port_tc_init(3);
}

void uc_led_off(int p_led)
{
        gpio_port_tc_set_pin_state(p_led, 0);
}
void uc_led_on(int p_led)
{
        gpio_port_tc_set_pin_state(p_led, 1);
}
void uc_led_toggle(int p_led)
{
        if (gpio_port_tc_get_pin_state(p_led) == 0)
        {
                uc_led_on(p_led);
        }
        else if (gpio_port_tc_get_pin_state(p_led) == 1)
        {
                uc_led_off(p_led);
        }
}
